home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcl / src-16f.lha / compiler / bit-util.lisp < prev    next >
Encoding:
Text File  |  1991-11-06  |  1.5 KB  |  58 lines

  1. ;;; -*- Package: C; Log: C.Log -*-
  2. ;;;
  3. ;;; **********************************************************************
  4. ;;; This code was written as part of the CMU Common Lisp project at
  5. ;;; Carnegie Mellon University, and has been placed in the public domain.
  6. ;;; If you want to use this code or any part of CMU Common Lisp, please contact
  7. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
  8. ;;;
  9. (ext:file-comment
  10.   "$Header: bit-util.lisp,v 1.4 91/02/20 14:56:42 ram Exp $")
  11. ;;;
  12. ;;; **********************************************************************
  13. ;;;
  14. ;;;    Bit-vector hacking utilities, potentially implementation-dependent for
  15. ;;; speed.
  16. ;;;
  17. ;;; Written by Rob MacLachlan
  18. ;;;
  19. (in-package 'c)
  20.  
  21. (declaim (inline clear-bit-vector set-bit-vector bit-vector-replace
  22.          bit-vector-copy))
  23.  
  24. ;;; Clear-Bit-Vector  --  Interface
  25. ;;;
  26. ;;;    Clear a bit-vector to zeros.
  27. ;;;
  28. (defun clear-bit-vector (vec)
  29.   (declare (type simple-bit-vector vec))
  30.   (bit-xor vec vec t))
  31.  
  32.  
  33. ;;; Set-Bit-Vector  --  Interface
  34. ;;;
  35. ;;;    Fill a bit vector with ones.
  36. ;;;
  37. (defun set-bit-vector (vec)
  38.   (declare (type simple-bit-vector vec))
  39.   (bit-orc2 vec vec t))
  40.  
  41.  
  42. ;;; Bit-Vector-Replace  --  Interface
  43. ;;;
  44. ;;;    Replace the bits in To with the bits in From.
  45. ;;;
  46. (defun bit-vector-replace (to from)
  47.   (declare (type simple-bit-vector to from))
  48.   (bit-ior from from to))
  49.  
  50.  
  51. ;;; Bit-Vector-Copy  --  Interface
  52. ;;;
  53. ;;;    Copy a bit-vector.
  54. ;;;
  55. (defun bit-vector-copy (vec)
  56.   (declare (type simple-bit-vector vec))
  57.   (bit-ior vec vec (make-array (length vec) :element-type 'bit)))
  58.